#include <stdio.h>
int main ()
{
    int n = 0;
    int i = 0;
    int out = 0;
    int count = 0;
    int arr[50];
 
    scanf ("%d",&n);

    for (i = 0; i < n ; i ++)
    {
        scanf ("%d",&arr[i]);
    }
    
    scanf ("%d",&out);

    
    for (i = 0; i < n ; i ++ )
    {
        if(arr[i]== out)
            arr[i] = 0;
    }
    
     for (i = 0; i < n ; i ++ )
     {
         if(arr[i]!=0)
         {
             printf("%d " ,arr[i]);
         }
     }
    return 0;
}